﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/Layouts/Admin.Master" AutoEventWireup="true"
    CodeBehind="NewsMananger.aspx.cs" Inherits="MLM.AdminCP.Pages.NewsMananger" meta:resourcekey="PageResource1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:Label ID="lbUserID" runat="server" Text="News Management" 
        meta:resourcekey="lbUserIDResource1"></asp:Label>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function RowDblClick(sender, eventArgs) {
                sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
            
        </script>
        <script type="text/javascript">
            var popUp;
            function PopUpShowing(sender, eventArgs) {
                popUp = eventArgs.get_popUp();
                var gridWidth = sender.get_element().offsetWidth;
                var gridHeight = sender.get_element().offsetHeight;
                var popUpWidth = popUp.style.width.substr(0, popUp.style.width.indexOf("px"));
                var popUpHeight = popUp.style.height.substr(0, popUp.style.height.indexOf("px"));
                popUp.style.left = (($(window).width() - popUpWidth) / 2) + "px";
                popUp.style.top = "100px";
            } 
        </script>
    </telerik:RadCodeBlock>
    <div>
        <asp:Label ID="Label1" runat="server" EnableViewState="False" Font-Bold="True" 
            ForeColor="#FF8080" meta:resourcekey="Label1Resource1"></asp:Label>
        <asp:Label ID="Label2" runat="server" EnableViewState="False" Font-Bold="True" 
            ForeColor="#00C000" meta:resourcekey="Label2Resource1"></asp:Label>
    </div>
    <telerik:RadGrid ID="RadNewsGrid" runat="server" AllowFilteringByColumn="True" DataSourceID="GroupNewsEds"
        AllowPaging="True" AllowSorting="True" GridLines="None" ShowGroupPanel="True"
         AllowAutomaticInserts="True" 
        AllowAutomaticUpdates="True" AllowAutomaticDeletes="True"
        ShowFooter="True" ShowStatusBar="True" 
        meta:resourcekey="RadNewsGridResource1">
        <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True">
            <Selecting AllowRowSelect="True" />

<ClientEvents OnRowDblClick="RowDblClick" OnPopUpShowing="PopUpShowing"></ClientEvents>

            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
        </ClientSettings>
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="NewsID" DataSourceID="GroupNewsEds"
            ShowHeader="true" ShowHeadersWhenNoRecords="true" AllowAutomaticInserts="true"
            CommandItemDisplay="TopAndBottom" EditMode="PopUp">
            <%--<MasterTableView ShowFooter="false" DataKeyNames="ProductID" EditMode="InPlace" CommandItemDisplay="TopAndBottom">--%>
            <CommandItemSettings ShowAddNewRecordButton="true" ShowRefreshButton="true">
                <%--ExportToPdfText="Export to Pdf">--%></CommandItemSettings>
            <RowIndicatorColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="NewsID" DataType="System.Int64" HeaderText="NewsID"
                    ReadOnly="True" SortExpression="NewsID" UniqueName="NewsID" 
                    meta:resourcekey="GridBoundColumnResource1">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Title" HeaderText="Title" SortExpression="Title"
                    UniqueName="Title" meta:resourcekey="GridBoundColumnResource2">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="CreatedDate" HeaderText="CreatedDate" SortExpression="CreatedDate"
                    UniqueName="CreatedDate" DataType="System.DateTime" 
                    meta:resourcekey="GridBoundColumnResource3">
                </telerik:GridBoundColumn>
                <%--<telerik:GridEditCommandColumn>
                </telerik:GridEditCommandColumn>--%>
                <telerik:GridEditCommandColumn ButtonType="ImageButton" 
                    UniqueName="EditCommandColumn" 
                    meta:resourcekey="GridEditCommandColumnResource1">
                    <ItemStyle CssClass="MyImageButton"></ItemStyle>
                </telerik:GridEditCommandColumn>
                <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                    ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                    UniqueName="DeleteColumn" meta:resourcekey="GridButtonColumnResource1">
                    <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton"></ItemStyle>
                </telerik:GridButtonColumn>
            </Columns>
            <EditFormSettings EditFormType="Template" InsertCaption="Add new item" CaptionFormatString="Edit Title: {0}"
                CaptionDataField="Title" PopUpSettings-Modal="true" FormTableItemStyle-HorizontalAlign="Left"
                FormTableButtonRowStyle-VerticalAlign="Top">
<EditColumn UniqueName="EditCommandColumn1"></EditColumn>

<FormTableItemStyle HorizontalAlign="Left"></FormTableItemStyle>

<FormTableButtonRowStyle VerticalAlign="Top"></FormTableButtonRowStyle>
                <FormTemplate>
                    <table id="Table2" style="border-collapse: collapse; padding-left: 20;">
                        <tr class="EditFormHeader1" style="height: 30">
                            <td style="font-size: small; width: 100px" colspan="2">
                                  <b><asp:Label ID="Label3" runat="server" Text="News Details" 
                                      meta:resourcekey="Label3Resource1"></asp:Label></b>
                            </td>
                        </tr>
                        <tr style="height: 30px">
                            <td class="titlename">
                                <asp:Label ID="lbTitle" runat="server" Text="Title:" 
                                    meta:resourcekey="lbTitleResource1"></asp:Label>
                            </td>
                            <td style="width: 50">
                                <telerik:RadTextBox CssClass="radtextbox" ID="RadTextBox2" runat="server" 
                                    Text='<%# Bind("Title") %>' LabelCssClass="" 
                                    meta:resourcekey="RadTextBox2Resource1">
                                </telerik:RadTextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Display="Dynamic"
                                    ControlToValidate="RadTextBox2" 
                                    ErrorMessage="The textbox can not be empty!" 
                                    meta:resourcekey="RequiredFieldValidator1Resource1"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr style="height: 30px">
                            <td style="width: 30">
                                <asp:Label ID="lbCreatedDate" runat="server" Text="CreatedDate:" 
                                    meta:resourcekey="lbCreatedDateResource1"></asp:Label>
                            </td>
                            <td>
                                <telerik:RadDatePicker ID="RadDatePicker1" runat="server" MinDate="1900-01-01" 
                                    TabIndex="4" Culture="en-US" meta:resourcekey="RadDatePicker1Resource1">
                                    <Calendar UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False" 
                                        ViewSelectorText="x">
                                    </Calendar>
                                    <DateInput DateFormat="M/d/yyyy" DisplayDateFormat="M/d/yyyy" TabIndex="4">
                                    </DateInput>
                                    <DatePopupButton CssClass="" HoverImageUrl="" ImageUrl="" TabIndex="4" />
                                </telerik:RadDatePicker>
                            </td>
                        </tr>
                    </table>
                    <table style="width: 200; height: 100">
                        <tr>
                            <td class="titlename">
                                <asp:Label ID="lbDetail" runat="server" Text="Detail:" 
                                    meta:resourcekey="lbDetailResource1"></asp:Label>
                            </td>
                        </tr>
                        <tr style="height: 200">
                            <td>
                                <telerik:RadEditor runat="server" ID="RadEditor2"
                                    Width="700px" meta:resourcekey="RadEditor2Resource1" Content='<%#Bind("Detail") %>'>
                                  
                                </telerik:RadEditor>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-bottom: 10; padding-top: 10">
                                <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                    runat="server" 
                                    CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' 
                                    meta:resourcekey="btnUpdateResource1">
                                </asp:Button>
                                &nbsp;
                                <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                    CommandName="Cancel" meta:resourcekey="btnCancelResource1"></asp:Button>
                            </td>
                        </tr>
                    </table>
                </FormTemplate>

<PopUpSettings Modal="True"></PopUpSettings>
            </EditFormSettings>
        </MasterTableView>
        <ClientSettings>
            <ClientEvents OnPopUpShowing="PopUpShowing" />
            <ClientEvents OnRowDblClick="RowDblClick"></ClientEvents>
        </ClientSettings>

<HeaderContextMenu EnableImageSprites="True" CssClass="GridContextMenu GridContextMenu_Office2007"></HeaderContextMenu>
    </telerik:RadGrid>
    <asp:EntityDataSource ID="GroupNewsEds" runat="server" ConnectionString="name=MLMDataContext"
        DefaultContainerName="MLMDataContext" EnableDelete="True" EnableFlattening="False"
        EnableInsert="True" EnableUpdate="True" EntitySetName="News">
    </asp:EntityDataSource>
</asp:Content>
<%--<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder4" runat="server">
</asp:Content>--%>
